//
//  RMMShoppingCartViewController.m
//  Romomo
//
//  Created by puman on 16/9/30.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMShoppingCartViewController.h"
#import "RMMShopingView.h"
#import "RMMShopingBuyView.h"
#import "RMMShopingTableViewCell.h"
#import "RMMGoodsConfirmViewController.h"
#import "RMMLongingViewController.h"
#import "RMMGoodsDetialsViewController.h"
#import "RMMTaoCanDetailsViewController.h"
#import "RMMHuLiDetailsViewController.h"

@interface RMMShoppingCartViewController ()<UITableViewDelegate, UITableViewDataSource>

@end

@implementation RMMShoppingCartViewController
{
    RMMShopingBuyView *_buyView;
    RMMShopingView *_shopView;
    UITableView *_tableView;
    BOOL _isAll;
    NSMutableDictionary *_dataDic;
    NSMutableDictionary *_goodsDic;
    NSMutableArray *_keyArray;
    CGFloat _totalPrice;
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[RMMFileManager shareHandle] saveVale:@"0" forKey:@"SHOPMARTCOUNT"];
    NS_POST(@"SHOPMARTCLEAN", nil, nil);
    if ([RMMFileManager shareHandle].isLoginSuccess) {
        NSArray *arrayA = _dataDic[@"我的服务"];
        NSArray *arrayB = _dataDic[@"我的套餐"];
        if (arrayA.count == 0 && arrayB.count == 0) {
            [self getShopData];
        }
        _tableView.hidden = NO;
        _shopView.hidden = YES;
    } else {
        _tableView.hidden = YES;
        _shopView.hidden = NO;
        [self addLoginAlertView];
    }
    if ([[RMMFileManager shareHandle].thred isEqualToString:@"1"]) {
        UITabBarController *VC = (UITabBarController *)keyWidow.rootViewController;
        [VC setSelectedIndex:2];

    }
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [RMMFileManager shareHandle].thred = @"0";
}
- (void)dealloc{
    NS_REM(@"SHOPFRESH", nil);
    NS_REM(@"TUICHUDENGLU", nil);
    NS_REM(kReachabilityChangedNotification, nil);
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = kWhiteColor;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBar.translucent = NO;
    // self.navigationController.tabBarItem.badgeValue = @"20";
    _dataDic = [NSMutableDictionary dictionary];
    [self addViews];
    __weak RMMShoppingCartViewController *mySelf = self;
    [mySelf refresh];
    NS_ADD(shopFresh, @"SHOPFRESH", nil);
}
- (void)refresh{
    _tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [self getShopData];
    }];

}
- (void)shopFresh{
    [self getShopData];
    [self cancelButSelcet];
}
- (void)getShopData{
    [_dataDic removeAllObjects];
    NSMutableDictionary *parDic = [NSMutableDictionary dictionary];
    NSString *cust_id = [RMMFileManager retrunObjWith:[RMMFileManager shareHandle].userDic[@"CUST_ID"]];
    parDic[@"cust_login_id"] = cust_id;
    parDic[@"loginorcust"] = @"1";
    parDic[@"ishome"] = [RMMFileManager shareHandle].fuWuType;
    NSString *url = GetShopMartUrl;
    [OSRequestManager requestWithUrlString:url parDic:parDic network:^(BOOL isNetwork) {
        if (!isNetwork) {
            [_tableView.mj_header endRefreshing];
        }
    } method:GET finish:^(NSDictionary *dataDic) {
        NSString *status = [NSString stringWithFormat:@"%@",dataDic[@"status"]];
        NSMutableArray *dataArrayA = [NSMutableArray array];
        NSMutableArray *dataArrayB = [NSMutableArray array];
        if ([status isEqualToString:@"1"]) {
            NSArray *array = dataDic[@"data"][@"ShopData"];
            for (NSDictionary *dic in array) {
                RMMShopingModel *model = [[RMMShopingModel alloc] init];
                [model setValuesForKeysWithDictionary:[RMMFileManager setValueForDic:dic]];
                model.MY_CARD_ID = @"0";
                [dataArrayA addObject:model];
            }
            NSArray *arrayT = dataDic[@"data"][@"MyDitel"];
            for (NSDictionary *newDic in arrayT) {
                NSArray *arrayF = newDic[@"PROD_SERVICES"];
                NSDictionary *prod_bom = newDic[@"PROD_BOM"];
                for (NSDictionary *oneDic in arrayF) {
                    RMMShopingModel *model = [[RMMShopingModel alloc] init];
                    [model setValuesForKeysWithDictionary:[RMMFileManager setValueForDic:oneDic]];
                    model.PRICE = @"0.00";
                    model.BOM_ID = prod_bom[@"BOM_ID"];
                    [dataArrayB addObject:model];
                }
            }
            if (dataArrayA.count) {
                [_dataDic setObject:dataArrayA forKey:@"我的服务"];
            }
            if (dataArrayB.count) {
                [_dataDic setObject:dataArrayB forKey:@"我的套餐"];
            }
            NSArray *arrays = [_dataDic allKeys];
            if (!arrays.count) {
                _shopView.hidden = NO;
                _tableView.hidden = YES;
                _buyView.hidden = YES;
            } else {
                _shopView.hidden = YES;
                _buyView.hidden = NO;
                _tableView.hidden = NO;
            }
            _keyArray = [NSMutableArray arrayWithArray:[_dataDic allKeys]];
            [_keyArray sortUsingSelector:@selector(compare:)];
        } else {
            [RMMFileManager MBProgressWith:dataDic[@"message"] onView:self.view];
        }
        [_tableView reloadData];
        [_tableView.mj_header endRefreshing];
    } error:^(NSError *errors) {
        [_tableView.mj_header endRefreshing];
    } view:self.view];
}
// 退出登录
- (void)tuiChuDengLu{
    [_dataDic removeAllObjects];
    [_goodsDic removeAllObjects];
    [_keyArray removeAllObjects];
    [self cancelButSelcet];
    [_tableView reloadData];
}
- (void)addViews{
    _isAll = NO;
    NS_ADD(tuiChuDengLu, @"TUICHUDENGLU", nil);
    _goodsDic = [NSMutableDictionary dictionary];
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWideth, kScreenHeight - 64 - 49 * 2) style:(UITableViewStylePlain)];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.separatorStyle = NO;
    [_tableView registerClass:[RMMShopingTableViewCell class] forCellReuseIdentifier:@"Cell"];
    [self.view addSubview:_tableView];
    
    _shopView = [[RMMShopingView alloc] initWithFrame:CGRectMake(0, 64, kScreenWideth, kScreenHeight - 113)];
    _shopView.hidden = YES;
    [self.view addSubview:_shopView];
    
    _buyView = [[RMMShopingBuyView alloc] initWithFrame:CGRectMake(0, _tableView.bottom, kScreenWideth, 49)];
    BUTTON_S(_buyView.buyAllBut, buyAllButClick);
    BUTTON_S(_buyView.goBuyBut, goBuyButClick);
    _buyView.hidden = YES;
    NS_ADD(networkStateChange:, kReachabilityChangedNotification, nil);
    [self.view addSubview:_buyView];
}
- (void)networkStateChange:(NSNotification *)notification{
        Reachability *wifi = [Reachability reachabilityForLocalWiFi];
        // 2.检测手机是否能上网络(WIFI\3G\2.5G)
        Reachability *conn = [Reachability reachabilityForInternetConnection];

        // 3.判断网络状态
        if ([wifi currentReachabilityStatus] != NotReachable) { // 有wifi
            NSLog(@"有wifi");
        } else if ([conn currentReachabilityStatus] != NotReachable) { // 没有使用wifi, 使用手机自带网络进行上网
        NSLog(@"使用手机自带网络进行上网");
        } else { // 没有网络
            NSLog(@"没有网络");
        }
}
- (void)addLoginAlertView{
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"查看购物车,需要您先前往登录" preferredStyle:(UIAlertControllerStyleAlert)];
    UIAlertAction *actionA = [UIAlertAction actionWithTitle:@"前往" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
        RMMLongingViewController *loginVC = [[RMMLongingViewController alloc] init];
        [self.navigationController pushViewController:loginVC animated:YES];
        
    }];
    UIAlertAction *actionB = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alertController addAction:actionA];
    [alertController addAction:actionB];
    [self presentViewController:alertController animated:YES completion:nil];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return _keyArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    NSString *key = _keyArray[_keyArray.count - 1 - section];
    NSMutableArray *value = _dataDic[key];
    return value.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 2 * kHalf - kRow;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    NSString *key = _keyArray[_keyArray.count - 1 - section];
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWideth, 40)];
    view.backgroundColor = kCColor;
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, view.width - 30, 40)];
    label.textColor = kBasicColor;
    label.font = kFont(14);
    label.text = key;
    [view addSubview:label];
    return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 40;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    RMMShopingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    NSString *key = _keyArray[_keyArray.count - 1 -indexPath.section];
    NSMutableArray *value = _dataDic[key];
    RMMShopingModel *model = value[indexPath.row];
    cell.model = model;
    cell.cellSelectBut.tag = 100000 * indexPath.section + indexPath.row + 10000;
    cell.subBut.tag = 100000 * indexPath.section + indexPath.row + 20000;
    cell.addBut.tag = 100000 * indexPath.section + indexPath.row + 30000;
    BUTTON_S(cell.cellSelectBut, cellSelectButClick:);
    BUTTON_S(cell.subBut, subButClick:);
    BUTTON_S(cell.addBut, addButClick:);
    if ([model.isSelect isEqualToString:@"1"]) {
        [cell.cellSelectBut setImage:[UIImage imageNamed:@"选中@3x"] forState:(UIControlStateNormal)];
    } else {
        [cell.cellSelectBut setImage:[UIImage imageNamed:@"可选@3x"] forState:(UIControlStateNormal)];
    }
    cell.countLabel.text = [NSString stringWithFormat:@"%@",model.COUNT];
    if ([model.COUNT isEqualToNumber:@1]) {
        [cell.subBut setImage:[UIImage imageNamed:@"un-subtract@3x"] forState:(UIControlStateNormal)];
        cell.subBut.userInteractionEnabled = NO;
    } else {
        [cell.subBut setImage:[UIImage imageNamed:@"subtract@3x"] forState:(UIControlStateNormal)];
        cell.subBut.userInteractionEnabled = YES;
    }
    return cell;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *key = _keyArray[_keyArray.count - 1 -indexPath.section];
    if ([key isEqualToString:@"我的服务"]) {
        return YES;
    } else {
        return NO;
    }
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *key = _keyArray[_keyArray.count - 1 - indexPath.section];
    NSMutableArray *value = _dataDic[key];
    if ([key isEqualToString:@"我的服务"]) {
        RMMShopingModel *model = value[indexPath.row];
        NSString *bom_id = [RMMFileManager retrunObjWith:model.BOM_ID];
        if (bom_id.length > 0 && ![bom_id isEqualToString:@"(null)"]) {
            RMMTaoCanDetailsViewController *VC = [[RMMTaoCanDetailsViewController alloc] init];
            VC.bom_id = model.BOM_ID;
            [self.navigationController pushViewController:VC animated:YES];
        } else {
            RMMGoodsDetialsViewController *VC = [[RMMGoodsDetialsViewController alloc] init];
            VC.service_id = model.SERVICE_ID;
            [self.navigationController pushViewController:VC animated:YES];
        }
    } else {
        return;
//        RMMShopingModel *model = value[indexPath.row];
//        RMMHuLiModel *huLiModel = [[RMMHuLiModel alloc] init];
//        huLiModel.NAME = model.SERVICE_NAME;
//        huLiModel.AVA_QTY = model.AVA_QTY;
//        huLiModel.PRICE = [NSNumber numberWithFloat:[model.PRICE floatValue ]];
//        huLiModel.SERVER_ID = model.SERVICE_ID;
//        huLiModel.SER_URL = model.IMAGEURL;
//        huLiModel.END_DATE = model.VALID_EDATE;
//        huLiModel.TIME_LEN = model.TIME_LEN;
//        huLiModel.MY_CARD_ID = model.MY_CARD_ID;
//        huLiModel.PROD_SERVICE_TYPE = model.PROD_SERVICE_TYPE;
//        huLiModel.IS_DELAY = model.IS_DELAY;
//        huLiModel.IS_HOME = [RMMFileManager shareHandle].fuWuType;
//        RMMHuLiDetailsViewController *VC = [[RMMHuLiDetailsViewController alloc] init];
//        VC.model = huLiModel;
//        VC.isHome = [RMMFileManager shareHandle].fuWuType;
//        [self.navigationController pushViewController:VC animated:YES];
    }
}
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *key = _keyArray[_keyArray.count - 1 -indexPath.section];
    NSMutableArray *value = _dataDic[key];
    RMMShopingModel *model = value[indexPath.row];
    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
        [self deleteShopMartDataWithShop_id:model.SHOP_ID];
    }];
    deleteAction.backgroundColor = [UIColor redColor];
    return @[deleteAction];
}
// 删除购物车中数据
- (void)deleteShopMartDataWithShop_id:(NSNumber *)shop_id{
    NSMutableDictionary *parDic = [NSMutableDictionary dictionary];
    parDic[@"org_no"] = Org_no;
    parDic[@"shop_id"] = shop_id;
    NSString *url = DeleteShopUrl;
    [OSRequestManager requestWithUrlString:url parDic:parDic method:GET finish:^(NSDictionary *dataDic) {
        NSString *status = [NSString stringWithFormat:@"%@",dataDic[@"status"]];
        if ([status isEqualToString:@"1"]) {
            [MMProgressHUD show];
            [MMProgressHUD dismissWithSuccess:@"删除成功!" title:nil afterDelay:1.0];
            [self getShopData];
        } else {
            [RMMFileManager MBProgressWith:dataDic[@"message"] onView:self.view];
        }
    } error:^(NSError *errors) {
        [_tableView.mj_header endRefreshing];
    } view:self.view];

}
- (void)cellSelectButClick:(UIButton *)button{
    NSInteger section = button.tag / 100000;
    NSString *key = _keyArray[_keyArray.count - section - 1];
    NSMutableArray *value = _dataDic[key];
    NSInteger row = button.tag % 100000 - 10000;
    RMMShopingModel *model = value[row];
    if ([model.isSelect isEqualToString:@"1"]) {
        model.isSelect = @"0";
        [button setImage:[UIImage imageNamed:@"可选@3x"] forState:(UIControlStateNormal)];
    } else {
        model.isSelect = @"1";
        [button setImage:[UIImage imageNamed:@"选中@3x"] forState:(UIControlStateNormal)];
    }
    NSString *imageName = nil;
    if (![self isAllSelectSubGoogsWithArray:_dataDic]) {
        _isAll = NO;
        imageName = @"可选@3x";
        [self cancelButSelcet];
    } else {
        _isAll = YES;
        [self goBuyButSelcet];
        imageName = @"选中@3x";
    }
    if ([self isSelectGoodsWith:_dataDic]) {
        [self goBuyButSelcet];
    } else {
        [self cancelButSelcet];
    }
    [_tableView reloadData];
    [_buyView.buyAllBut setImage:[UIImage imageNamed:imageName] forState:(UIControlStateNormal)];
    CGFloat totalPrice = [self getToatalPriceWithArray:_dataDic];
    _buyView.totalPriceLabel.text = [NSString stringWithFormat:@"总计: ¥%.2f",totalPrice];
}
// 判断有没选择商品
- (BOOL)isSelectGoodsWith:(NSDictionary *)dic{
    for (NSString *key in dic) {
        NSArray *array = dic[key];
        for (RMMShopingModel *model in array) {
            if ([model.isSelect isEqualToString:@"1"]) {
                return YES;
            }
        }
    }
    return NO;
}
- (BOOL)isAllSelectSubGoogsWithArray:(NSDictionary *)dic{
    BOOL isA = YES;
    for (NSString *key in dic) {
        NSArray *array = dic[key];
        for (RMMShopingModel *model in array) {
            if (![model.isSelect isEqualToString:@"1"]) {
                isA = NO;
                return NO;
            }
         }
    }
    return isA;
}
- (void)subButClick:(UIButton *)button{
    NSInteger section = button.tag / 100000;
    NSString *key = _keyArray[_keyArray.count - section - 1];
    NSMutableArray *value = _dataDic[key];
    NSInteger row = button.tag % 100000 - 20000;
    RMMShopingModel *model = value[row];
    NSInteger cout = [model.COUNT integerValue];
    if (cout == 1) {
        [button setImage:[UIImage imageNamed:@"un-subtract@3x"] forState:(UIControlStateNormal)];
        button.userInteractionEnabled = NO;
    } else {
        cout -= 1;
        model.COUNT = [NSNumber numberWithInteger:cout];
    }
    [_tableView reloadData];
    CGFloat totalPrice = [self getToatalPriceWithArray:_dataDic];
    _buyView.totalPriceLabel.text = [NSString stringWithFormat:@"总计: ¥%.2f",totalPrice];
}
- (void)addButClick:(UIButton *)button{
    NSInteger section = button.tag / 100000;
    NSString *key = _keyArray[_keyArray.count - section - 1];
    NSMutableArray *value = _dataDic[key];
    NSInteger row = button.tag % 100000 - 30000;
    RMMShopingModel *model = value[row];
    NSInteger cout = [model.COUNT integerValue];
    if (model.BOM_ID.length) {
        // 是套餐
        NSInteger ava_qty = [model.AVA_QTY integerValue];
        if (cout == ava_qty) {
            [RMMFileManager MBProgressWith:@"可用次数不足!" onView:self.view];
            return;
        }
    } else {
        // 是服务
        if (cout == 99) {
            [RMMFileManager MBProgressWith:@"单一服务数量不能超过99!" onView:self.view];
            return;
        }
    }
    cout += 1;
    model.COUNT = [NSNumber numberWithInteger:cout];
    if (cout >= 2) {
        UIButton *but = [self.view viewWithTag:button.tag - 10000];
        [but setImage:[UIImage imageNamed:@"subtract@3x"] forState:(UIControlStateNormal)];
        but.userInteractionEnabled = YES;
    }
    [_tableView reloadData];
    CGFloat totalPrice = [self getToatalPriceWithArray:_dataDic];
    _buyView.totalPriceLabel.text = [NSString stringWithFormat:@"总计: ¥%.2f",totalPrice];
}
// 全选
- (void)buyAllButClick{
    _isAll = !_isAll;
    NSString *imageName = nil;
    if (!_isAll) {
        //_buyView.imageV.image = [UIImage imageNamed:@"可选@2x"];
        imageName = @"可选@3x";
        [self cancelButSelcet];
        for (NSString *key in _dataDic) {
            NSMutableArray *value = _dataDic[key];
            for (RMMShopingModel *model in value) {
                model.isSelect = @"0";
            }
        }
    } else {
       // _buyView.imageV.image = [UIImage imageNamed:@"选中@2x"];
        [self goBuyButSelcet];
        for (NSString *key in _dataDic) {
            NSMutableArray *value = _dataDic[key];
            for (RMMShopingModel *model in value) {
                model.isSelect = @"1";
            }
        }
        imageName = @"选中@3x";
    }
    [_tableView reloadData];
    CGFloat totalPrice = [self getToatalPriceWithArray:_dataDic];
    _buyView.totalPriceLabel.text = [NSString stringWithFormat:@"总计: ¥%.2f",totalPrice];
    [_buyView.buyAllBut setImage:[UIImage imageNamed:imageName] forState:(UIControlStateNormal)];
}
// 得到全价钱的方法
- (CGFloat)getToatalPriceWithArray:(NSMutableDictionary *)dic{
    CGFloat totalPrcie = 0.00;
    for (NSString *key in dic) {
        NSArray *array = dic[key];
        for (RMMShopingModel *model in array) {
            if ([model.isSelect isEqualToString:@"1"]) {
                if (!model.BOM_ID.length) {
                    CGFloat prcie = [model.PRICE floatValue];
                    NSInteger count = [model.COUNT integerValue];
                    totalPrcie += prcie * count;
                }
            }
        }
    }
//    if (totalPrcie > 0) {
//        [self goBuyButSelcet];
//    } else {
//        [self cancelButSelcet];
//    }
    _totalPrice = totalPrcie;
    return totalPrcie;
}
// 去结账
- (void)goBuyButClick{
    [RMMFileManager shareHandle].fromSkillType = @"0";
    RMMGoodsConfirmViewController *VC = [[RMMGoodsConfirmViewController alloc] init];
    VC.goodsArray = [NSMutableArray array];
    for (NSString *key in _dataDic) {
        NSMutableArray *value = _dataDic[key];
        for (RMMShopingModel *model in value) {
            if ([model.isSelect isEqualToString:@"1"]) {
                [VC.goodsArray addObject:model];
            }
        }
    }
    if (VC.goodsArray.count == 1) {
        RMMShopingModel *models = VC.goodsArray[0];
        if ([models.PROD_SERVICE_TYPE isEqualToString:@"1"] && [models.COUNT isEqualToNumber:@1]) {
            [RMMFileManager MBProgressWith:@"辅助项目不能单独购买!" onView:self.view];
            return;
        }
    }
    VC.tabBarController.hidesBottomBarWhenPushed = YES;
    VC.isHome = [RMMFileManager shareHandle].fuWuType;
    [self.navigationController pushViewController:VC animated:YES];

}
- (void)goBuyButSelcet{
    [_buyView.goBuyBut setTitleColor:kWhiteColor forState:(UIControlStateNormal)];
    _buyView.goBuyBut.userInteractionEnabled = YES;
    _buyView.goBuyBut.backgroundColor = COLORFROMCODE(0x53C7C6, 1);
}
- (void)cancelButSelcet{
    [_buyView.goBuyBut setTitleColor:COLORFROMCODE(0xD7D7D7, 1) forState:(UIControlStateNormal)];
    [_buyView.buyAllBut setImage:[UIImage imageNamed:@"可选@3x"] forState:(UIControlStateNormal)];
    _buyView.goBuyBut.userInteractionEnabled = NO;
    _buyView.goBuyBut.backgroundColor = kWhiteColor;

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
